package school_text;

import java.util.Scanner;

class CyLinder{
    double radius;
    int height;
    double pi;
    void setCyLinder(double r,int h,double p){
        pi=p;
        radius=r;
        height=h;
        System.out.println("得到圆柱的半径、高、圆周率分别为："+radius+" "+height+" "+pi);
    }
    double area()
    {
        return pi*radius*radius;
    }
    //调用类内部的求底面积方法的计算体积
    double volume(){
        return area()*height;
    }
}
public class APP6_4 {
    public static void main(String[] args) {
        double r,p;
        int h;
        Scanner reader=new Scanner(System.in);
        CyLinder volu=new CyLinder();
        System.out.print("输入圆柱的半径：");
        r= reader.nextDouble();
        System.out.print("输入圆柱底面积的圆周率：");
        p= reader.nextDouble();
        System.out.print("输入圆柱的高：");
        h= reader.nextInt();
        volu.setCyLinder(r,h,p);
       System.out.println("圆柱：");
       System.out.println("底面积："+volu.area());
       System.out.println("体积："+volu.volume());
    }
}
